package com.tepth.repair;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.app.ActionBar;

import com.tencent.bugly.beta.Beta;
import com.zhangyu.shadow.repair.base.RootDelegate;
import com.zhangyu.shadow.repair.event.CheckVersionEvent;

import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.Subscribe;

import qiu.niorgai.StatusBarCompat;
import st.lib.base.activity.ProxyActivity;
import st.lib.base.delegate.ShadowDelegate;

/**
 * @author Administrator
 */
public class MainActivity extends ProxyActivity {
    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        EventBus.getDefault().register(this);
        ActionBar actionBar = getSupportActionBar();
        if (actionBar != null) {
            actionBar.hide();
        }
        StatusBarCompat.setStatusBarColor(this,
                getResources().getColor(R.color.colorPrimary));
    }

    @Override
    public ShadowDelegate setRootDelegate() {
        return RootDelegate.newInstance();
    }

    @Subscribe
    public void onCheckVersionEvent(CheckVersionEvent event) {
        Beta.checkUpgrade(true, false);
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
        EventBus.getDefault().unregister(this);
    }
}
